package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import jtk.project4.fleet.domain.Customers;



public class CustomersDao extends IbatisDao{
	public List selectCustomers() throws SQLException {
		List selectCustomers = null;
			selectCustomers =getSqlMap().queryForList("SELECT_ALL_CUSTOMERS", null);
		return selectCustomers;
	}

	public int deleteCustomers(Customers customers) throws SQLException{
		return (int) getSqlMap().delete("DELETE_CUSTOMERS", customers);
	}
	
	public int updateCustomers(Customers customers) throws SQLException{
		return (int) getSqlMap().update("UPDATE_CUSTOMERS", customers);
	}
	
	public Customers insertCustomers(Customers customers) throws SQLException{
	return (Customers) getSqlMap().insert("INSERT_CUSTOMERS", customers);
	}
	
	public void insertCustomers2(Customers customers) throws SQLException{
		new CustomersDao().insertCustomers(customers);
	}
	
	public Customers insertCustomersType(Customers customers) throws SQLException {
		return (Customers) getSqlMap().insert("INSERT_CUSTOMERS_TYPE",customers);
	}
	
	public List selectCostumersType() throws SQLException {
		return getSqlMap().queryForList("SELECT_ALL_CUSTOMERS_TYPE", null);
	}
		

	
		
	public static void main (String args[]) throws SQLException{
		Customers customers;
		customers = new Customers();
		customers.setName("sdfghjk");
		new CustomersDao().insertCustomers(customers);
		}
	
}
